package com.le.tester.onjava8.l1_1;

/**
 * createTime：2022/10/19 17:08
 * description：使用enum中values()
 */
public class EnumClass {
    public static void main(String[] args) {
        //enum值的遍历
        for (Shrubbery s : Shrubbery.values()) {
            System.out.println(s + "ordinal:" + s.ordinal());

            System.out.println(s.compareTo(Shrubbery.CRAWLING) + " ");

            System.out.println(s.equals(Shrubbery.CRAWLING + " "));

            System.out.println(s == Shrubbery.CRAWLING);

            System.out.println(s.getDeclaringClass());

            System.out.println(s.name());

            System.out.println("********************************");
        }

        for (String s : "HANGING CRAWLING GROUND".split(" ")) {
            Shrubbery shrubbery = Enum.valueOf(Shrubbery.class, s);
            System.out.println(shrubbery);
        }
    }
}
